package com.adminserver.customEntity;

import cn.hutool.crypto.digest.DigestUtil;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "system-account")
public class SystemAccountEntity {

    private String account;
    private String password;

    @Autowired
    SaltEntity saltEntity;

    public String getAccount() {
        return DigestUtil.md5Hex(DigestUtil.md5Hex(account).concat(saltEntity.getAccount()));
    }

    public String getPassword() {
        return DigestUtil.md5Hex(DigestUtil.md5Hex(password).concat(saltEntity.getAccount()));
    }
}
